Skip to content

Add repository URL generation feature#25

Merged
zhisme merged 25 commits intomasterfrom
claude/implement-changes-01Ct6f1YhtsXyDNCCePSeJVY
Nov 24, 2025
Merged

Add repository URL generation feature#25
zhisme merged 25 commits intomasterfrom
claude/implement-changes-01Ct6f1YhtsXyDNCCePSeJVY

Conversation

@zhisme
Copy link
Copy Markdown
Owner

@zhisme zhisme commented Nov 14, 2025

Implement comprehensive repository URL generation when copying code snippets, transforming output to include direct permalinks to the code in GitHub, GitLab, or Bitbucket.

Features:

  • Automatic git repository detection and remote URL parsing
  • Support for GitHub, GitLab, and Bitbucket (including Enterprise/self-hosted)
  • Always uses commit SHA for stable permalinks
  • Lazy provider detection with extensible architecture
  • Graceful degradation when not in a git repo
  • Configurable via include_remote_url option (default: true)

Implementation:

  • New git.lua module for git operations
  • Provider architecture with lazy loading
  • Integration into existing utils.format_output
  • Comprehensive test coverage for all components
  • Updated documentation with examples

Supported URL formats:

  • GitHub: /blob/{sha}/{path}#L{start}[-L{end}]
  • GitLab: /-/blob/{sha}/{path}#L{start}[-{end}]
  • Bitbucket: /src/{sha}/{path}#lines-{start}[:{end}]

Handles edge cases:

  • Detached HEAD, submodules, multiple remotes
  • Windows path conversion, untracked files
  • HTTPS, SSH, and git:// protocol URLs

fixes #1

Loading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

add context integration with remote repo URL

2 participants